<!DOCTYPE html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
    <title>个人信息 </title>
    <link href="https://fonts.googleapis.com/css?family=Nunito:400,600,700" rel="stylesheet">
    <link th:href="@{/assets/img/favicon.ico}" rel="icon" type="image/x-icon"/>
    <link th:href="@{/bootstrap/css/bootstrap.min.css}" rel="stylesheet" type="text/css" />
    <link th:href="@{/assets/css/plugins.css}" rel="stylesheet" type="text/css" />
    <link th:href="@{/plugins/dropify/dropify.min.css}"rel="stylesheet" type="text/css"  >
    <link th:href="@{/assets/css/users/account-setting.css}" rel="stylesheet" type="text/css" />


    <link th:href="@{/plugins/sweetalerts/sweetalert2.min.css}" rel="stylesheet" type="text/css" />
    <link th:href="@{/plugins/sweetalerts/sweetalert.css}" rel="stylesheet" type="text/css" />
    <link th:href="@{/assets/css/components/custom-sweetalert.css}" rel="stylesheet" type="text/css" />

    <link th:href="@{/plugins/notification/snackbar/snackbar.min.css}" rel="stylesheet" type="text/css" />



    <style>
        .menu {
            height: 50px;
            line-height: 50px;
        }
    </style>
</head>

<body class="alt-menu sidebar-noneoverflow">

    <!--  BEGIN NAVBAR  -->
    <div class="header-container fixed-top">
        <header class="header navbar navbar-expand-sm expand-header">
            <a href="javascript:void(0);" class="sidebarCollapse" data-placement="bottom"><svg
                    xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
                    stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                    class="feather feather-menu">
                    <line x1="3" y1="12" x2="21" y2="12"></line>
                    <line x1="3" y1="6" x2="21" y2="6"></line>
                    <line x1="3" y1="18" x2="21" y2="18"></line>
                </svg></a>

            <ul class="navbar-item flex-row ml-auto">
                <li class="nav-item dropdown user-profile-dropdown  order-lg-0 order-1">
                    <a href="javascript:void(0);" class="nav-link dropdown-toggle user" id="userProfileDropdown"
                       data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
                             stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                             class="feather feather-user-check">
                            <path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                            <circle cx="8.5" cy="7" r="4"></circle>
                            <polyline points="17 11 19 13 23 9"></polyline>
                        </svg>
                    </a>
                    <div class="dropdown-menu position-absolute e-animated e-fadeInUp"
                         aria-labelledby="userProfileDropdown">
                        <div class="user-profile-section">
                            <div class="media mx-auto">
                                <div class="media-body">
                                    <h5>[[${admin.username}]]</h5>
                                </div>
                            </div>
                        </div>
                        <div class="dropdown-item">
                            <a href="/admin/userinfo">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-user">
                                    <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                                    <circle cx="12" cy="7" r="4"></circle>
                                </svg> <span>个人信息</span>
                            </a>
                        </div>
                        <div class="dropdown-item">
                            <a href="/admin/out">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-log-out">
                                    <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
                                    <polyline points="16 17 21 12 16 7"></polyline>
                                    <line x1="21" y1="12" x2="9" y2="12"></line>
                                </svg> <span>退出登录</span>
                            </a>
                        </div>
                    </div>
                </li>
            </ul>
        </header>
    </div>
    <!--  END NAVBAR  -->

    <!--  BEGIN MAIN CONTAINER  -->
    <div class="main-container sidebar-closed sbar-open" id="container">

        <div class="overlay"></div>
        <div class="cs-overlay"></div>
        <div class="search-overlay"></div>

        <!--  BEGIN SIDEBAR  -->
        <div class="sidebar-wrapper sidebar-theme">

            <nav id="sidebar">

                <ul class="navbar-nav theme-brand flex-row  text-center">
                </ul>

                <ul class="list-unstyled menu-categories" id="accordionExample">
                    <li class="menu " th:if="${admin.type != 3}">
                        <a href="/admin" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-home">
                                    <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                                    <polyline points="9 22 9 12 15 12 15 22"></polyline>
                                </svg>
                                <span>首页</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu" th:if="${admin.type < 2}">
                        <a href="/admin/appsContacts" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-layout">
                                    <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
                                    <line x1="3" y1="9" x2="21" y2="9"></line>
                                    <line x1="9" y1="21" x2="9" y2="9"></line>
                                </svg>
                                <span>团队管理</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu" th:if="${admin.type == 2}">
                        <a href="/admin/people" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-layout">
                                    <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
                                    <line x1="3" y1="9" x2="21" y2="9"></line>
                                    <line x1="9" y1="21" x2="9" y2="9"></line>
                                </svg>
                                <span>成员管理</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu" th:if="${admin.type < 2}">
                        <a href="/admin/activityList" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-box">
                                    <path
                                            d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z">
                                    </path>
                                    <polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
                                    <line x1="12" y1="22.08" x2="12" y2="12"></line>
                                </svg>
                                <span>活动管理</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu " th:if="${admin.type == 3}">
                        <a href="/admin/share" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-home">
                                    <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                                    <polyline points="9 22 9 12 15 12 15 22"></polyline>
                                </svg>
                                <span>首页</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu " th:if="${admin.type == 2}">
                        <a href="/admin/share" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-home">
                                    <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                                    <polyline points="9 22 9 12 15 12 15 22"></polyline>
                                </svg>
                                <span>邀请客户</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu active">
                        <a href="/admin/userinfo" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-user">
                                    <path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
                                    <circle cx="12" cy="7" r="4"></circle>
                                </svg>
                                <span>个人信息</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu">
                        <a href="/admin/personInfo" aria-expanded="true" class="dropdown-toggle">
                            <div class="">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
                                     fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                                     stroke-linejoin="round" class="feather feather-users">
                                    <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                                    <circle cx="9" cy="7" r="4"></circle>
                                    <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
                                    <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
                                </svg>
                                <span>客户信息</span>
                            </div>
                        </a>
                    </li>
                </ul>
            </nav>

        </div>
        <!--  END SIDEBAR  -->

        <!--  BEGIN CONTENT AREA  -->
        <div id="content" class="main-content">
            <div class="layout-px-spacing">

                <div class="account-settings-container layout-top-spacing">

                    <div class="account-content">
                        <div class="scrollspy-example" data-spy="scroll" data-target="#account-settings-scroll"
                            data-offset="-100">
                            <div class="row">
                                <div class="col-xl-12 col-lg-12 col-md-12 layout-spacing">
                                    <form class="section general-info" id="form1" onsubmit="return false" action="##" method="post">
                                        <div class="info">
                                            <h6 class="">个人信息</h6>
                                            <div class="row">
                                                <div class="col-lg-11 mx-auto">
                                                    <div class="row">
                                                        <div class="col-xl-2 col-lg-12 col-md-4">
                                                            <div class="upload mt-4 pr-md-4">
                                                                <img th:src="@{/assets/img/avatar.png}" alt=""
                                                                    style="width: 7.5rem;height: 7.5rem;">
                                                            </div>
                                                        </div>
                                                        <div class="col-xl-10 col-lg-12 col-md-8 mt-md-0 mt-4">
                                                            <div class="form">
                                                                <div class="row">
                                                                    <div class="col-sm-6">
                                                                        <div class="form-group">
                                                                            <label>账号</label>
                                                                            <input type="number" class="form-control mb-4"
                                                                                id="account"
                                                                                   th:value="${admin.account}" disabled="true">
                                                                            <input type="number" class="form-control mb-4"
                                                                                    name="account"
                                                                                   th:value="${admin.account}" hidden="hidden">
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label >姓名</label>
                                                                            <input type="text" class="form-control mb-4"
                                                                                id="username"  name="username" placeholder="请输入姓名"
                                                                                   th:value="${admin.username}">
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label >手机号</label>
                                                                            <input type="text" class="form-control mb-4"
                                                                                id="phone" name="phone" placeholder="请输入手机号"
                                                                                   th:value="${admin.phone}">
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label >旧密码</label>
                                                                            <input type="text" class="form-control mb-4"
                                                                                   id="oldpassword" name="oldpassword" placeholder="请输入旧密码"
                                                                                   value="">
                                                                        </div>
                                                                        <div class="form-group">
                                                                            <label >密码</label>
                                                                            <input type="text" class="form-control mb-4"
                                                                                id="password" name="password" placeholder="请输入新密码"
                                                                                value="">
                                                                        </div>

                                                                        <div class="form-group">
                                                                            <button id="multiple-messages"
                                                                                class="btn btn-primary"
                                                                                style="margin:0 auto;" onclick="save()">保存</button>
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <!--  END CONTENT AREA  -->
    </div>
    <!-- END MAIN CONTAINER -->

    <script th:src="@{/assets/js/libs/jquery-3.1.1.min.js}" ></script>
    <script th:src="@{/bootstrap/js/popper.min.js}"></script>
    <script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/plugins/perfect-scrollbar/perfect-scrollbar.min.js}"></script>
    <script th:src="@{/assets/js/app.js}"></script>
    <script th:src="@{/assets/js/custom.js}"></script>
    <script th:src="@{/plugins/dropify/dropify.min.js}"></script>
    <script th:src="@{/plugins/blockui/jquery.blockUI.min.js}"></script>
    <script th:src="@{/assets/js/users/account-settings.js}"></script>
    <!-- BEGIN THEME GLOBAL STYLE -->
    <script th:src="@{/assets/js/scrollspyNav.js}"></script>
    <script th:src="@{/plugins/sweetalerts/sweetalert2.min.js}"></script>
    <script th:src="@{/plugins/sweetalerts/custom-sweetalert.js}"></script>
    <script th:src="@{/plugins/notification/snackbar/snackbar.min.js}"></script>
    <!-- END THEME GLOBAL STYLE -->

    <script>
        $(document).ready(function () {
            App.init();
        });

        if([[${IsEditPwd}]] ==1){
            swal({
                title: '首次登陆提示',
                text: '请修改登陆密码及个人信息',
                timer: 3000,
                padding: '2em',
                onOpen: function () {
                    swal.showLoading()
                }
            }).then(function (result) {
                if (
                    // Read more about handling dismissals
                    result.dismiss === swal.DismissReason.timer
                ) {
                    console.log('I was closed by the timer')
                }
            })
        }

        function save() {
            var username = $("#username").val();
            var phone = $("#phone").val();
            var oldpassword = $("#oldpassword").val();
            var password = $("#password").val();

            if (username ==""){
                Snackbar.show({
                    text: '请输入姓名',
                    pos: 'top-center'
                });
                return false;
            }
            if (phone == ""){
                Snackbar.show({
                    text: '请输入手机号',
                    pos: 'top-center'
                });
                return false;
            }

            if(password!=""){
                if(oldpassword==""){
                    Snackbar.show({
                        text: '请输入旧密码',
                        pos: 'top-center'
                    });
                    return false;
                }
            }

            $.ajax({
                type: "POST",//方法类型
                url: "/admin/userinfo" ,//url
                data: $('#form1').serialize(),
                success: function (result) {
                    if(result.code == "500"){
                        Snackbar.show({
                            text: result.msg,
                            pos: 'top-center'
                        });
                    }else if(result.code == "200"){
                        Snackbar.show({
                            text: result.msg,
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.reload();
                        }, 1500);
                    }else if(result.code == "100"){
                        Snackbar.show({
                            text: "您已掉线！",
                            pos: 'top-center'
                        });
                        setTimeout(function (){
                            window.location.href="/admin/login";
                        }, 1500);
                    }
                },
                error : function() {
                    Snackbar.show({
                        text: '请稍后再试',
                        pos: 'top-center'
                    });
                }
            });
        }


    </script>

</body>

</html>
